﻿var app = angular.module("app", ["xeditable"]);
app.run(function (editableOptions) {
    editableOptions.theme = 'bs3'; // bootstrap3 theme. Can be also 'bs2', 'default'
});

app.controller('EditableRowCtrl', function ($scope, $filter, $http) {
    $('#ajax_loader').show();

    $http.get('/api/bannerapi/get').success(function (data) {
        $scope.banners = data;
        $('#ajax_loader').hide();
    })
    .error(function () {
        $('#ajax_loader').hide();
    });


    // remove Location
    $scope.removeBanner = function (index) {
        var delBanner = $scope.banners[index];
        $('#myModal-' + index).modal('toggle');
        $('.modal-backdrop').remove();
        return $http.post('/banner/delete', { id: delBanner.id }).success(function () {
            $scope.banners.splice(index, 1);
        });
    };
});